<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../kindeditor/kindeditor-all.js"></script>
    <script src="../kindeditor/kindeditor-all-min.js"></script>
    <script src="../kindeditor/Gruntfile.js"></script>
    <script src="../kindeditor/lang/zh-CN.js"></script>
    <script src="../kindeditor/lib/jquery.min.js"></script>
</head>
<body>

<textarea id="editor_id" name="photoContent" style="width:1100px;height:450px;">
    <img th:src="@{${fileName}}"/>
</textarea>
<script>
    var editor;		//在js中定义一个变量
    KindEditor.ready(function(K) {
        editor = K.create('textarea[name="photoContent"]', {
            // filePostName:"uploadFile",      //默认与后台对应文件名称为imgFile
            allowFileManager : true,
            allowImageUpload:true,//允许上传图片 打开本地上传图片功能
            items:['fontname', 'fontsize', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'removeformat', 'justifyleft', 'justifycenter', 'justifyright',
                'insertorderedlist', 'insertunorderedlist', 'emoticons', 'image', 'insertfile'
            ],
            uploadJson: "uploadImg",		//上传图片的后台接口路径
            allowImageRemote: false,
            afterBlur: function(){this.sync();},   ////失去焦点时，将上传内容同步到textarea中
            afterUpload : function(url, data, name) { //上传文件后执行的回调函数，必须为3个参数
                if(name=="image" || name=="multiimage"){ //单个和批量上传图片时
                    var img = new Image();
                    img.src = url;
                    img.onload = function(){ //图片必须加载完成才能获取尺寸

                    }
                }
            }

        });
    });
</script>
</body>
</html>